home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3
/
CHAPTE22
/
EX18.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-27
|
2KB
|
53 lines
#include <genstub.c>
#include <stdarg.h>
static char cTheNumber[] = "Twenty Seven Hundred Fifty Four";
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
switch ( LOWORD( wParam ) )
{
case IDM_TEST:
{
TCHAR szBuffer[128];
DWORD dwArgs[3];
HDC hDC = GetDC( hWnd );
dwArgs[1] = dwArgs[0] = 2754;
dwArgs[2] = (DWORD) cTheNumber;
wvsprintf( szBuffer,
"The number %d is hex %x or string %s",
dwArgs );
TextOut(hDC, 0, 0, szBuffer, lstrlen(szBuffer));
wvsprintf( szBuffer,
"The number %d is hex %X or string %s",
dwArgs );
TextOut(hDC, 0, 20, szBuffer, lstrlen(szBuffer));
wvsprintf( szBuffer,
"The number %010d is hex %#x = string %36s",
dwArgs );
TextOut(hDC, 0, 40, szBuffer, lstrlen(szBuffer));
wvsprintf( szBuffer,
"The number %-10d is hex %#X = string %-36s",
dwArgs );
TextOut(hDC, 0, 60, szBuffer, lstrlen(szBuffer));
ReleaseDC( hWnd, hDC );
}
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
}
return( NULL );
}